Optimal. Leaf size=187 \[ \frac {\left (2 a^2 A+A b^2-3 a b B\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (d+e x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} (a+b)^{5/2} e}+\frac {C}{2 b e (a+b \cos (d+e x))^2}-\frac {(A b-a B) \sin (d+e x)}{2 \left (a^2-b^2\right ) e (a+b \cos (d+e x))^2}-\frac {\left (3 a A b-a^2 B-2 b^2 B\right ) \sin (d+e x)}{2 \left (a^2-b^2\right )^2 e (a+b \cos (d+e x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 187, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.226, Rules used = {4462, 2833, 12,
2738, 211, 2747, 32} \begin {gather*} \frac {\left (2 a^2 A-3 a b B+A b^2\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (d+e x)\right )}{\sqrt {a+b}}\right )}{e (a-b)^{5/2} (a+b)^{5/2}}-\frac {\left (a^2 (-B)+3 a A b-2 b^2 B\right ) \sin (d+e x)}{2 e \left (a^2-b^2\right )^2 (a+b \cos (d+e x))}-\frac {(A b-a B) \sin (d+e x)}{2 e \left (a^2-b^2\right ) (a+b \cos (d+e x))^2}+\frac {C}{2 b e (a+b \cos (d+e x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 32
Rule 211
Rule 2738
Rule 2747
Rule 2833
Rule 4462
Rubi steps
\begin {align*} \int \frac {A+B \cos (d+e x)+C \sin (d+e x)}{(a+b \cos (d+e x))^3} \, dx &=C \int \frac {\sin (d+e x)}{(a+b \cos (d+e x))^3} \, dx+\int \frac {A+B \cos (d+e x)}{(a+b \cos (d+e x))^3} \, dx\\ &=-\frac {(A b-a B) \sin (d+e x)}{2 \left (a^2-b^2\right ) e (a+b \cos (d+e x))^2}-\frac {\int \frac {-2 (a A-b B)+(A b-a B) \cos (d+e x)}{(a+b \cos (d+e x))^2} \, dx}{2 \left (a^2-b^2\right )}-\frac {C \text {Subst}\left (\int \frac {1}{(a+x)^3} \, dx,x,b \cos (d+e x)\right )}{b e}\\ &=\frac {C}{2 b e (a+b \cos (d+e x))^2}-\frac {(A b-a B) \sin (d+e x)}{2 \left (a^2-b^2\right ) e (a+b \cos (d+e x))^2}-\frac {\left (3 a A b-a^2 B-2 b^2 B\right ) \sin (d+e x)}{2 \left (a^2-b^2\right )^2 e (a+b \cos (d+e x))}+\frac {\int \frac {2 a^2 A+A b^2-3 a b B}{a+b \cos (d+e x)} \, dx}{2 \left (a^2-b^2\right )^2}\\ &=\frac {C}{2 b e (a+b \cos (d+e x))^2}-\frac {(A b-a B) \sin (d+e x)}{2 \left (a^2-b^2\right ) e (a+b \cos (d+e x))^2}-\frac {\left (3 a A b-a^2 B-2 b^2 B\right ) \sin (d+e x)}{2 \left (a^2-b^2\right )^2 e (a+b \cos (d+e x))}+\frac {\left (2 a^2 A+A b^2-3 a b B\right ) \int \frac {1}{a+b \cos (d+e x)} \, dx}{2 \left (a^2-b^2\right )^2}\\ &=\frac {C}{2 b e (a+b \cos (d+e x))^2}-\frac {(A b-a B) \sin (d+e x)}{2 \left (a^2-b^2\right ) e (a+b \cos (d+e x))^2}-\frac {\left (3 a A b-a^2 B-2 b^2 B\right ) \sin (d+e x)}{2 \left (a^2-b^2\right )^2 e (a+b \cos (d+e x))}+\frac {\left (2 a^2 A+A b^2-3 a b B\right ) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (d+e x)\right )\right )}{\left (a^2-b^2\right )^2 e}\\ &=\frac {\left (2 a^2 A+A b^2-3 a b B\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (d+e x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} (a+b)^{5/2} e}+\frac {C}{2 b e (a+b \cos (d+e x))^2}-\frac {(A b-a B) \sin (d+e x)}{2 \left (a^2-b^2\right ) e (a+b \cos (d+e x))^2}-\frac {\left (3 a A b-a^2 B-2 b^2 B\right ) \sin (d+e x)}{2 \left (a^2-b^2\right )^2 e (a+b \cos (d+e x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.90, size = 175, normalized size = 0.94 \begin {gather*} \frac {-\frac {2 \left (2 a^2 A+A b^2-3 a b B\right ) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (d+e x)\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{5/2}}+\frac {\left (-3 a A b+a^2 B+2 b^2 B\right ) \sin (d+e x)}{(a-b)^2 (a+b)^2 (a+b \cos (d+e x))}+\frac {\left (a^2-b^2\right ) C-b (A b-a B) \sin (d+e x)}{(a-b) b (a+b) (a+b \cos (d+e x))^2}}{2 e} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.39, size = 270, normalized size = 1.44
method | result | size |
derivativedivides | \(\frac {\frac {-\frac {\left (4 A a b +A \,b^{2}-2 B \,a^{2}-B a b -2 B \,b^{2}\right ) \left (\tan ^{3}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )}{\left (a -b \right ) \left (a^{2}+2 a b +b^{2}\right )}-\frac {2 C \left (\tan ^{2}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )}{a -b}-\frac {\left (4 A a b -A \,b^{2}-2 B \,a^{2}+B a b -2 B \,b^{2}\right ) \tan \left (\frac {e x}{2}+\frac {d}{2}\right )}{\left (a +b \right ) \left (a^{2}-2 a b +b^{2}\right )}-\frac {2 a C}{a^{2}-2 a b +b^{2}}}{\left (a \left (\tan ^{2}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )+a +b \right )^{2}}+\frac {\left (2 a^{2} A +A \,b^{2}-3 B a b \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {e x}{2}+\frac {d}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{e}\) | \(270\) |
default | \(\frac {\frac {-\frac {\left (4 A a b +A \,b^{2}-2 B \,a^{2}-B a b -2 B \,b^{2}\right ) \left (\tan ^{3}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )}{\left (a -b \right ) \left (a^{2}+2 a b +b^{2}\right )}-\frac {2 C \left (\tan ^{2}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )}{a -b}-\frac {\left (4 A a b -A \,b^{2}-2 B \,a^{2}+B a b -2 B \,b^{2}\right ) \tan \left (\frac {e x}{2}+\frac {d}{2}\right )}{\left (a +b \right ) \left (a^{2}-2 a b +b^{2}\right )}-\frac {2 a C}{a^{2}-2 a b +b^{2}}}{\left (a \left (\tan ^{2}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {e x}{2}+\frac {d}{2}\right )\right )+a +b \right )^{2}}+\frac {\left (2 a^{2} A +A \,b^{2}-3 B a b \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {e x}{2}+\frac {d}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{e}\) | \(270\) |
risch | \(\frac {2 i B \,a^{4} {\mathrm e}^{2 i \left (e x +d \right )}-3 i A a \,b^{3}+2 i B \,b^{4}+5 i B \,a^{2} b^{2} {\mathrm e}^{2 i \left (e x +d \right )}+3 i B a \,b^{3} {\mathrm e}^{3 i \left (e x +d \right )}-3 i A a \,b^{3} {\mathrm e}^{2 i \left (e x +d \right )}+2 i B \,b^{4} {\mathrm e}^{2 i \left (e x +d \right )}-6 i A \,a^{3} b \,{\mathrm e}^{2 i \left (e x +d \right )}-10 i A \,a^{2} b^{2} {\mathrm e}^{i \left (e x +d \right )}-i A \,b^{4} {\mathrm e}^{3 i \left (e x +d \right )}+4 i B \,a^{3} b \,{\mathrm e}^{i \left (e x +d \right )}+5 i B a \,b^{3} {\mathrm e}^{i \left (e x +d \right )}+2 C \,a^{4} {\mathrm e}^{2 i \left (e x +d \right )}-4 C \,a^{2} b^{2} {\mathrm e}^{2 i \left (e x +d \right )}+2 C \,b^{4} {\mathrm e}^{2 i \left (e x +d \right )}+i B \,a^{2} b^{2}-2 i A \,a^{2} b^{2} {\mathrm e}^{3 i \left (e x +d \right )}+i A \,b^{4} {\mathrm e}^{i \left (e x +d \right )}}{b \left (a^{2}-b^{2}\right )^{2} e \left (b \,{\mathrm e}^{2 i \left (e x +d \right )}+2 a \,{\mathrm e}^{i \left (e x +d \right )}+b \right )^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (e x +d \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) a^{2} A}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} e}-\frac {\ln \left ({\mathrm e}^{i \left (e x +d \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A \,b^{2}}{2 \sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} e}+\frac {3 \ln \left ({\mathrm e}^{i \left (e x +d \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B a b}{2 \sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} e}+\frac {\ln \left ({\mathrm e}^{i \left (e x +d \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) a^{2} A}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} e}+\frac {\ln \left ({\mathrm e}^{i \left (e x +d \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A \,b^{2}}{2 \sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} e}-\frac {3 \ln \left ({\mathrm e}^{i \left (e x +d \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B a b}{2 \sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} e}\) | \(834\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 390 vs.
\(2 (173) = 346\).
time = 0.51, size = 856, normalized size = 4.58 \begin {gather*} \left [\frac {2 \, C a^{6} - 6 \, C a^{4} b^{2} + 6 \, C a^{2} b^{4} - 2 \, C b^{6} - {\left (2 \, A a^{4} b - 3 \, B a^{3} b^{2} + A a^{2} b^{3} + {\left (2 \, A a^{2} b^{3} - 3 \, B a b^{4} + A b^{5}\right )} \cos \left (x e + d\right )^{2} + 2 \, {\left (2 \, A a^{3} b^{2} - 3 \, B a^{2} b^{3} + A a b^{4}\right )} \cos \left (x e + d\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (x e + d\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (x e + d\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (x e + d\right ) + b\right )} \sin \left (x e + d\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (x e + d\right )^{2} + 2 \, a b \cos \left (x e + d\right ) + a^{2}}\right ) + 2 \, {\left (2 \, B a^{5} b - 4 \, A a^{4} b^{2} - B a^{3} b^{3} + 5 \, A a^{2} b^{4} - B a b^{5} - A b^{6} + {\left (B a^{4} b^{2} - 3 \, A a^{3} b^{3} + B a^{2} b^{4} + 3 \, A a b^{5} - 2 \, B b^{6}\right )} \cos \left (x e + d\right )\right )} \sin \left (x e + d\right )}{4 \, {\left ({\left (a^{6} b^{3} - 3 \, a^{4} b^{5} + 3 \, a^{2} b^{7} - b^{9}\right )} \cos \left (x e + d\right )^{2} e + 2 \, {\left (a^{7} b^{2} - 3 \, a^{5} b^{4} + 3 \, a^{3} b^{6} - a b^{8}\right )} \cos \left (x e + d\right ) e + {\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} e\right )}}, \frac {C a^{6} - 3 \, C a^{4} b^{2} + 3 \, C a^{2} b^{4} - C b^{6} + {\left (2 \, A a^{4} b - 3 \, B a^{3} b^{2} + A a^{2} b^{3} + {\left (2 \, A a^{2} b^{3} - 3 \, B a b^{4} + A b^{5}\right )} \cos \left (x e + d\right )^{2} + 2 \, {\left (2 \, A a^{3} b^{2} - 3 \, B a^{2} b^{3} + A a b^{4}\right )} \cos \left (x e + d\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (x e + d\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (x e + d\right )}\right ) + {\left (2 \, B a^{5} b - 4 \, A a^{4} b^{2} - B a^{3} b^{3} + 5 \, A a^{2} b^{4} - B a b^{5} - A b^{6} + {\left (B a^{4} b^{2} - 3 \, A a^{3} b^{3} + B a^{2} b^{4} + 3 \, A a b^{5} - 2 \, B b^{6}\right )} \cos \left (x e + d\right )\right )} \sin \left (x e + d\right )}{2 \, {\left ({\left (a^{6} b^{3} - 3 \, a^{4} b^{5} + 3 \, a^{2} b^{7} - b^{9}\right )} \cos \left (x e + d\right )^{2} e + 2 \, {\left (a^{7} b^{2} - 3 \, a^{5} b^{4} + 3 \, a^{3} b^{6} - a b^{8}\right )} \cos \left (x e + d\right ) e + {\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} e\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 502 vs.
\(2 (173) = 346\).
time = 0.53, size = 502, normalized size = 2.68 \begin {gather*} {\left (\frac {{\left (2 \, A a^{2} - 3 \, B a b + A b^{2}\right )} {\left (\pi \left \lfloor \frac {x e + d}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) - b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {a^{2} - b^{2}}} + \frac {2 \, B a^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} - 4 \, A a^{2} b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} - B a^{2} b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} + 3 \, A a b^{2} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} + B a b^{2} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} + A b^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} - 2 \, B b^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{3} - 2 \, C a^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{2} - 2 \, C a^{2} b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{2} + 2 \, C a b^{2} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{2} + 2 \, C b^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{2} + 2 \, B a^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) - 4 \, A a^{2} b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) + B a^{2} b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) - 3 \, A a b^{2} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) + B a b^{2} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) + A b^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) + 2 \, B b^{3} \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right ) - 2 \, C a^{3} - 4 \, C a^{2} b - 2 \, C a b^{2}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{2} - b \tan \left (\frac {1}{2} \, x e + \frac {1}{2} \, d\right )^{2} + a + b\right )}^{2}}\right )} e^{\left (-1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.50, size = 283, normalized size = 1.51 \begin {gather*} \frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (\frac {d}{2}+\frac {e\,x}{2}\right )\,\left (2\,a-2\,b\right )\,\left (a^2-2\,a\,b+b^2\right )}{2\,\sqrt {a+b}\,{\left (a-b\right )}^{5/2}}\right )\,\left (2\,A\,a^2-3\,B\,a\,b+A\,b^2\right )}{e\,{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{5/2}}-\frac {\frac {2\,C\,{\mathrm {tan}\left (\frac {d}{2}+\frac {e\,x}{2}\right )}^2}{a-b}+\frac {2\,C\,a}{{\left (a-b\right )}^2}-\frac {{\mathrm {tan}\left (\frac {d}{2}+\frac {e\,x}{2}\right )}^3\,\left (2\,B\,a^2-A\,b^2+2\,B\,b^2-4\,A\,a\,b+B\,a\,b\right )}{{\left (a+b\right )}^2\,\left (a-b\right )}-\frac {\mathrm {tan}\left (\frac {d}{2}+\frac {e\,x}{2}\right )\,\left (A\,b^2+2\,B\,a^2+2\,B\,b^2-4\,A\,a\,b-B\,a\,b\right )}{\left (a+b\right )\,\left (a^2-2\,a\,b+b^2\right )}}{e\,\left (2\,a\,b+{\mathrm {tan}\left (\frac {d}{2}+\frac {e\,x}{2}\right )}^2\,\left (2\,a^2-2\,b^2\right )+{\mathrm {tan}\left (\frac {d}{2}+\frac {e\,x}{2}\right )}^4\,\left (a^2-2\,a\,b+b^2\right )+a^2+b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________